﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using ResponsavelLib.Basic;
using ResponsavelLib.Repositorio;
using ResponsavelLib.Regra;

namespace ResponsavelService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        RegResponsavel regras = new RegResponsavel();

        [WebMethod]
        public void incluir(Responsavel obj)
        {
            try
            {
                regras.campoVazio(obj);
                RepResponsavel.getInstancia().incluir(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public void inserir(Responsavel obj,int matricula)
        {
            try
            {
                regras.campoVazio(obj);
                RepResponsavel.getInstancia().inserir(obj,matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public List<Responsavel> listar()
        {
                return RepResponsavel.getInstancia().listar();
        }

        [WebMethod]
        public List<Responsavel> pesquisar(int matricula)
        {
                return RepResponsavel.getInstancia().pesquisar(matricula);
        }

        [WebMethod]
        public void alterar(Responsavel obj, int matricula)
        {
            try
            {
                regras.campoVazio(obj);
                RepResponsavel.getInstancia().alterar(obj,matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public void excluir(int CodResp)
        {
                RepResponsavel.getInstancia().excluir(CodResp);
        }
    }
}